<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        var timer = 10;
        function changeTimer(){
            if(timer >= 0){
                document.getElementById("showTime").innerText = "当前剩余时间："+timer+"s";
                timer--;
            }else{
                window.location = "https://www.baidu.com";
            }
        }
    </script>
</head>
<body onload="setInterval('changeTimer()',1000)">
<div id="showTime"></div>
</body>
</html>